<?php

class App_Validate_DbRowExists extends App_Validate_DbUnique
{
    const NON_EXISTENT = 'non_existent';

    protected $_messageTemplates = array(
        self::NON_EXISTENT => '%column% %value% does not exist in our database'
    );

    public function __construct(Zend_Db_Table_Abstract $table, $column)
    {
        parent::__construct($table, $column);
    }

    public function isValid($value)
    {
        $isValid = !parent::isValid($value);

        if ($isValid == false) {
            $this->_error(self::NON_EXISTENT);
        }

        return $isValid;
    }
}
